package net.melon.product.inst.hibernate.mapping.dto;

import java.sql.ResultSet;
import java.sql.SQLException;

import net.melon.jdbc.core.RowMapper;
import net.melon.product.pojo.Product;
import net.melon.product.pojo.ProductClassify;

public class ProductMapRow implements RowMapper<Product>{

	@Override
	public Product mapRow(ResultSet rs, int arg1) throws SQLException {
		Product product = new Product();
		product.setId(rs.getString("ID"));
		product.setName(rs.getString("NAME"));
		product.setSerial(rs.getString("SERIAL"));
		product.setPrice(rs.getDouble("PRICE"));
		product.setState(rs.getInt("STATE"));
		product.setClassifyId(rs.getLong("CLASSIFY_ID"));
		product.setMarketEnable(rs.getInt("MARKET_ENABLE"));
		product.setClassify(new ProductClassify(rs.getLong("CLASSIFY_ID"),rs.getString("c_name")));
		product.setStock(rs.getInt("STOCK"));
		product.setSell(rs.getInt("SELL"));
		product.setClick(rs.getDouble("CLICK"));
		product.setGuidePrice(rs.getDouble("GUIDE_PRICE"));
		product.setFloorReferencePrice(rs.getDouble("FLOOR_PEFERENCE_PRICE"));
		product.setMarketTime(rs.getTimestamp("MARKET_TIME"));
		return product;
	}

}
